<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" href="css/layui.css" />
		<script src="js/layui.all.js"></script>
		<script src="js/jquery.min.js"></script>
	</head>
	<style>
		#state_table{
			width: 100%;
			text-align: left;
			font-weight: normal;
			font-size: 14px;
			text-indent: 3em;
			
		}
		th,td{
			font-weight: normal;
			border-bottom: solid 1px #C7C7C7;
		}
	
		#state_table tr{
			width: 100%;
			height: 35px;
			line-height: 35px;
		}
		.col_ta1{
			width: 20%;
		}
		.col_ta2{
			width: 40%;
		}
		.col_ta3{
			width: 40%;
		}
		.blue{
			color:#3c8dbc;
		}
	</style>
	<body>
		<table id="state_table" >
			<tr style="background: #f2f2f2;">
				<th style="width: 20%;">序号</th>
				<th style="width: 40%;">兑换码</th>
				<th style="width: 40%;padding-right: 3px;">状态</th>
			</tr>
			
		</table>
		<div style="width: 100%;height: 450px;overflow: auto;">
			<table id="state_table" class="table_data">
				 
			</table>
		</div>
	</body>
	<script>
		function GetQueryString(name)
		{
		     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
		     var r = window.location.search.substr(1).match(reg);
		     if(r!=null)return  unescape(r[2]); return null;
		}
		var numId = GetQueryString('num');
		var tableList=[];
	  	  	$.ajax({
						  		type:"get",
						  		url:"https://www.retux.cn/MgCouponCodeList",
						  		async:true,
						  		data:{
						  			Id:numId
						  		},
						  		success:function(data){
						  			if(data[0].length){
						  				
						  				for (var i=0;i<data.length;i++) {
						  					for(var j=0;j<data[i].length;j++){
						  						var str;
						  						if(data[i][j][1]=='未使用'){
						  						 str = `<tr>
						  						                 <td class="col_ta1">${j+1}</td>
						  						                 <td  class="col_ta2">${data[i][j][0]}</td>
						  						                 <td  class="col_ta3 blue">${data[i][j][1]}</td>
						  						            </tr>`;
						  						 }else{
						  						  str = `<tr>
						  						                 <td class="col_ta1">${j+1}</td>
						  						                 <td  class="col_ta2">${data[i][j][0]}</td>
						  						                 <td  class="col_ta3">${data[i][j][1]}</td>
						  						            </tr>`;
						  						 }
						  						      $('.table_data').append(str);
						  						   
							  				}
							  			}
						  			}
						  		
						  		  
						  		}
						  });
		
	</script>
</html>
